#!/usr/bin/env bash
cd /var/local
wget http://124.223.11.108:13000/demo2099/install/raw/branch/main/mysqld.cnf
wget http://124.223.11.108:13000/demo2099/install/raw/branch/main/my.cnf

docker run -p 3306:3306 --restart=always  --name mysql -v /var/local/mysqld.cnf:/etc/mysql/mysql.conf.d/mysqld.cnf -v /var/local/my.cnf:/etc/my.cnf  -v /var/local/mysql/logs:/var/log/mysql -v /var/local/mysql/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=lihao123 -d mysql:5.7


#然后自己创建库和开放访问
wget https://gitee.com/available2099/backup/blob/master/ruoyi.zip

docker exec -i mysql sh -c 'exec mysql -uroot -plihao123' <<EOF
grant all privileges on *.* to root@'%' identified by "lihao123";
CREATE DATABASE IF NOT EXISTS sspanel CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE DATABASE IF NOT EXISTS stock CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE DATABASE IF NOT EXISTS ruoyi CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
EOF

docker exec -i mysql sh -c 'exec mysql -uroot -plihao123 ruoyi' < ruoyi_2022_07_09_07_00_01.sql

docker restart mysql
docker run -d  -e ENABLE_FLAC=true -e ENABLE_LOCAL_VIP=true -e NODE_ENV=production  --log-opt max-size=10m -p 70:8080 --name unblock163  --restart=always pan93412/unblock-netease-music-enhanced  -e "https://music.163.com" -f 59.111.160.195
cd /root
mkdir bark-data

docker run -dt --name bark -p 9080:8080 -v `pwd`/bark-data:/data --restart=always finab/bark-server
docker run --name my_redis -p 6379:6379 -v /var/local/redis/data:/data -v /var/local/redis/conf/redis.conf:/etc/redis/redis.conf --privileged=true --restart=always  -d redis redis-server /etc/redis/redis.conf  --appendonly yes  --requirepass "lihao"
docker run -d -p 7070:7070  --restart=always --name jianshang   available2099/jianshang:v1
docker run  -d --name nginxdist  --restart=always  -p 80:80  available2099/nginxdist:latest
docker run -d -p 9900:5678 -p 9999:9999 -e crontype=do --name crontool --restart=always -v /usr/bin/docker:/usr/bin/docker -v /var/run/docker.sock:/var/run/docker.sock -v /var/local/crondata:/var/local/crondata   -e ENABLE_HANGUP=true -e ENABLE_WEB_PANEL=true available2099/crontool:final
docker run -d --privileged=true --restart=always --name=gitea -p 10022:22 -p 13000:3000 -v /var/local/crondata/gitea:/data gitea/gitea:latest